<section class="ui-amp-container">
  <header><h2><?php echo $formTitle ?></h2></header>
  
  <?php $this->AmpForm->dataProvider = array('Options', 'value') ?>
  
  <?php echo $this->AmpForm->form(null,
    $this->AmpForm->select('amp_mail_engine', __('Engine') . ':', $mailEngineOptions, array('amp_mail_engine', 'MAIL')),
  
    $this->AmpForm->fieldset(__('SMTP'), array('fieldset'=>array('id'=>'SMTPOptions', 'style'=>'display:none;')), 
      $this->AmpForm->text('amp_smtp_host', __('Host') . ':', array('amp_smtp_host', 'localhost'), 
        array('label'=>array('style'=>'width:130px;'))),
      $this->AmpForm->text('amp_smtp_port', __('Port') . ':', array('amp_smtp_port', 25), 
        array('label'=>array('style'=>'width:130px;'))),
      $this->AmpForm->select('amp_mail_auth', __('Authentication') . ':', $mailAuthOptions, array('amp_mail_auth', 'TRUE'), 
        array('label'=>array('style'=>'width:130px;'))),
      $this->AmpForm->text('amp_smtp_user', __('Username') . ':', 'amp_smtp_user', 
        array('label'=>array('style'=>'width:130px;'))),
      $this->AmpForm->text('amp_smtp_pass', __('Password') . ':', array('amp_smtp_pass'), 
        array('label'=>array('style'=>'width:130px;')))
    ),
    $this->AmpForm->save()
  ) ?>
</section>

<script type="text/javascript">
  $('select[name=amp_mail_engine]').change(function() {
	  var on = $(this).val() == 'SMTP';
    $('#SMTPOptions').toggle(on) ;
  }).change();
</script>